package com.iyao_app.util;

import android.app.Activity;
import android.net.Uri;
import android.widget.ImageView;

import com.bumptech.glide.Glide;
import com.iyao_app.R;
import com.lzy.imagepicker.loader.ImageLoader;

import java.io.File;

/**
 * 作者 :  胡家兵
 * 时间 :  2017/11/14.
 */

public class PickImageLoader implements ImageLoader {
    @Override
    public void displayImage(Activity activity, String path, ImageView imageView, int width, int height) {

        Glide.with(activity)//
                .load(Uri.fromFile(new File(path)))//
                .centerCrop()//

                .placeholder(R.drawable.defult_0)//
                .error(R.drawable.defult_0)//
                .override(width, height)//
                .into(imageView);
    }

    @Override
    public void displayImagePreview(Activity activity, String path, ImageView imageView, int width, int height) {
        Glide.with(activity)//
                .load(Uri.fromFile(new File(path)))//
                .centerCrop()//
                .override(width, height)//
                .into(imageView);
    }

    @Override
    public void clearMemoryCache() {

    }
}
